package org.example.udp;

import java.net.*;

public class UdpServer {
    public static void main(String[] args) throws Exception{
        DatagramSocket socket = new DatagramSocket(8888);
        while (true){
            byte[] bytes = new byte[1024];
            DatagramPacket packet = new DatagramPacket(bytes, bytes.length);
            socket.receive(packet);
            System.out.println(new String(packet.getData(),0, packet.getLength()));
        }
    }
}
